﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MediaGarden.Pipeline;
using Downplay.Mechanics.Services;

namespace MediaGarden.Images.Thumbnails
{
    public class ThumbnailContentFilter : IMediaContentFilter
    {
        private readonly IMechanicsService _mechanics;

        public ThumbnailContentFilter(
            IMechanicsService mechanics
            )
        {
            _mechanics = mechanics;
        }

        public void ContentFiltering(MediaCreateContext context)
        {
        }

        public void ContentFiltered(MediaCreateContext context)
        {
            if (context.Source.MediaStereotype == "Image")
            {
                // Link to self
                _mechanics.CreateConnector(context.ContentItem, context.ContentItem, "Thumbnail", true);
            }
        }
    }
}